home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
libs
/
svgabg55
/
notestc.svg
< prev
next >
Wrap
Text File
|
1994-08-23
|
4KB
|
108 lines
SuperVGA TrueColor (24-bit) BGI driver
Version 1.7
August 23, 1994
Revisions:
1.7 - August 23, 1994
1.2 - July 20, 1994
1.1 - May 30, 1994
1.0 - April 30, 1994
This is the latest version of my SuperVGA TrueColor BGI driver. All functions
have been implemented, but there may still be bugs. This driver will only
work on a 386 or higher.
Note: Palette functions, and the mouse cursor will not work with this driver.
The mouse cursor will work if you have the HGXMOUSE TSR loaded.
Using the HiColor driver:
Implementing the TrueColor color driver involved several hacks, as
the BGI interface only supports 8-bit color values, but the driver
needed support for 24-bit color values. The procedures that needed
to be changed were those that accepted color values, (SetColor,
SetFillStyle, SetFillPattern, PutPixel and Floodfill) and those
that return color values (GetColor and GetPixel).
As the TrueColor modes do not support palettes, I decided to use
the SetRgbPalette call to set colors, as it accepts values for the
R,G and B components of the color.
The format of a pixel in the TrueColor modes is:
-Byte 2- -Byte 1- -Byte 0-
RRRRRRRR GGGGGGGG BBBBBBBB
Several new functions are defined to make the color selection easier.
In addition, the macro RGB(rv,gv,bv) has been defined. It packs
the R, G and B values into the format described above and returns the
combined color.
* RealDrawColor(); - Sets the current drawing color.
Usage:
setcolor(RealDrawColor(RGB(rval,gval,bval)); - HiColor modes
setcolor(RealDrawColor(cval)); - (suggested for any other driver)
* RealFillColor(); - Sets the current fill color.
Usage:
setfillstyle(fillstyle,RealFillColor(RGB(rval,gval,bval)));
setfillstyle(fillstyle,RealFillColor(cval));
setfillpattern(fillpat,RealFillColor(RGB(rval,gval,bval)));
setfillpattern(fillpat,RealFillColor(cval));
* RealColor(); - For putpixel, sets the color of the pixel
- For floodfill, sets the color of the boundary
putpixel(x,y,RealColor(RGB(rval,gval,bval)));
putpixel(x,y,RealColor(cval));
floodfill(x,y,RealColor(RGB(rval,gval,bval)));
floodfill(x,y,RealColor(cval));
* RealDrawColor, RealFillColor, and RealColor all use a hacked
interface to setrgbpalette. If you would rather use the call
directly, the format is:
RealDrawColor:
setrgbpalette(1024,Rval,Gval,Bval);
RealFillColor:
setrgbpalette(1025,Rval,Gval,Bval);
RealColor:
setrgbpalette(1026,Rval,Gval,Bval);
where Rval, Gval, Bval = 0..255.
* GetPixel normally only returns an 8-bit value. However, the
value returned from the BGI driver is a 32-bit value in EDX (the
BGI kernel loads the value into AX and clears the upper 8 bits),
so to read the value of a pixel:
In Pascal:
Color := getpixel(x,y);
inline($89/$56/<Color); (* Loads 32-bit color value from EDX *)
In C:
Color = getpixel(x,y);
Color = _EDX;
* Paging information:
Mode Paging? # of pages (with 1024k)
320x200 yes 4
640x350 yes 1
640x400 yes 1
640x480 no 1
800x600 no N/A
1024x768 no N/A
1280x1024 no N/A
* Works with: ATI, Cirrus, Everex, NCR, Oak-077, Primus 2000,
Paradise WD90c3x and VESA [v1.2+]
o Drivers now have compile-time support for BGI version 3.0.
Supports protected mode with Borland Pascal 7.0 (1.0)
o Fixed Chips & Technologies detect bug (1.1)
o Integrated support for HGXMOUSE mouse cursor TSR. (1.2)
o Fixed IIT AGX bankswitch bug (1.7)
o Started 386 code optimization (1.7)